/**
 * OperatingSystem.js
 *
 * @description :: A model definition represents a database table/collection.
 * @docs        :: https://sailsjs.com/docs/concepts/models-and-orm/models
 */

module.exports = {

  attributes: {

    //  ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦  ╦╔═╗╔═╗
    //  ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
    //  ╩  ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
    name: {
      type: 'string',
      description: 'The name of the operating system',
      extendedDescription: 'this value is called name_only in the Fleet API',
      required: true,
    },

    fullName: {
      type: 'string',
      description: 'The name and version of the operating system.',
      extendedDescription: 'this value is called name in the Fleet API',
      unique: true,
      required: true,
    },

    platform: {
      type: 'string',
      description: 'The platform of this operating system.',
      required: true,
    },

    versionName: {
      type: 'string',
      extendedDescription: 'this comes from the version in the Fleet API',
      required: true,
    },

    lastReportedHostCount: {
      type: 'number',
      description: 'The last reported number of hosts using this operating system.',
      required: true,
    },

    isCompliant: {
      type: 'boolean',
      description: 'Wheter this operating system version has been explicitly set as compliant',
      defaultsTo: false,
    },

    //  ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
    //  ║╣ ║║║╠╩╗║╣  ║║╚═╗
    //  ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝


    //  ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
    //  ╠═╣╚═╗╚═╗║ ║║  ║╠═╣ ║ ║║ ║║║║╚═╗
    //  ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
    hosts: { collection: 'Host', via: 'operatingSystem', description: 'All hosts that are currently using this operating system.' },
  },

};

